#!/usr/bin/env sh

tool_name=$0

usage() {
    echo "Usage: ${tool_name} <option>"
    echo
    echo 'Example:'
    echo "  ${tool_name} -h"
    echo
    echo 'Options:'
    echo
    echo '-h, --help    Show help'
    echo '-l            shell command `ls -A --color=auto`'
    echo '-L            shell command `ls -A -l --color=auto`'
}

main() {
    if [ ! $1 ]; then
        usage
        exit 1
    fi

    # Parse arguments
    while [ $# -gt 0 ]; do
    case $1 in
      -l) ls -A --color=auto; exit ;;
      -L) ls -A -l --color=auto; exit ;;
      -h | --help) usage; exit ;;
      *) echo -e "Unrecognized option: $1\n"; usage; exit 2 ;;
    esac
    shift
    done
}

main "$@"
